package com.guoliang.wechatpushing.utils;

import com.guoliang.wechatpushing.constant.Constant;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * @author ：Leo
 * @date ：Created in 2022/10/18 11:04
 * @description：
 */
public class DateUtils {
    private static SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd EEEE", Locale.SIMPLIFIED_CHINESE);
    private static SimpleDateFormat simpleDateFormat2=new SimpleDateFormat("yyyy-MM-dd", Locale.SIMPLIFIED_CHINESE);
    //获取日期 格式：2022-10-18 星期二
    public static String getDate(){
        return simpleDateFormat.format(System.currentTimeMillis());
    }
    public static String getToday(){
        return simpleDateFormat2.format(System.currentTimeMillis());
    }
    public static Integer IntervalDays(String begin,String end) throws ParseException {
        Date d1 = simpleDateFormat2.parse(begin);
        Date d2 = simpleDateFormat2.parse(end);
        int d=(int)((d1.getTime()-d2.getTime())/(24*60*60*1000));
        return d;
    }
}
